<?php
$this->Html->addCrumb('Quote Email Recipients');
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
         $(".deleteLink").click(function(event){
          var $link = $(this);
          $.TWS_Overlay("confirm", {title : "Delete confirmation", message : "Are you sure you want to delete this email?", buttons : {ok :{onclick : function () { $.TWS_Overlay("hide"); location.href=$link.attr("href");}}}});
          event.preventDefault();
        });

      });
       ';
$this->Html->scriptEnd();
?>

<h1>Quote Email Recipients</h1>
<?php echo $this->Session->flash();?>
<p>When online quotes are submitted via the website, an email will be sent to the recipient(s) specified here.</p>
<?php echo '<div id="actionLink">'.$this->Html->link('Add Quote Email Recipients', array('controller' => 'QuoteEmails', 'action' => 'add')).'</div>'; ?>
<? if (empty($quoteEmails)) { echo '<p>No Quote Email Recipients have been specified.</p>'; }
 else {
  ?>
   <table class="results" style="width: 200px;" >
    <thead>
      <tr>
        <th>Email</th>
        <th>&nbsp;</th>
      <tr>
   </thead>
   <tbody>
      <?php foreach ($quoteEmails as $quoteEmail) {
        $rec = $quoteEmail['QuoteEmail'];
        $deleteLink = $this->Html->link('Delete', array('controller' => 'QuoteEmails', 'action' => 'delete', $rec['id']), array("title"=>"Delete this record", "class"=>'deleteLink'));
        echo '<tr>';
        echo '<td>'.$rec['email'].'</td>';
        echo "<td>$deleteLink</td>";
        echo '</tr>';
      }?>
   </tbody>
   </table>
  

 <?php } ?>

